package com.wash.shoes.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wash.shoes.domain.vo.CustomerCouponVo;
import com.wash.shoes.entity.CouponPo;
import com.wash.shoes.entity.CustomerCouponPo;
import com.wash.shoes.mapper.CustomerCouponMapper;
import com.wash.shoes.page.PageFactory;
import com.wash.shoes.service.CustomerCouponService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ljg
 * @since 2024-12-01
 */
@Service
public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper, CustomerCouponPo> implements CustomerCouponService {


    /**
     * 查询数据的列表
     *
     * @param CustomerCouponVo 优惠卷
     * @return 列表数据
     */
    @Override
    public Page<CustomerCouponVo> pageList(CustomerCouponVo customerCouponVo) {
        Page<CustomerCouponVo> page = PageFactory.defaultPage();
        List<CustomerCouponVo> dataList = baseMapper.pageList(page, customerCouponVo);
        page.setRecords(dataList);
        return page;
    }

    /**
     * 查询数量
     *
     * @param customerId
     * @param couponId
     * @return
     */
    @Override
    public List<CustomerCouponPo> getUserCouponCount(String customerId, String couponId) {
        return this.baseMapper.getUserCouponCount(customerId, couponId);
    }

    @Override
    public CustomerCouponPo getByOrderId(String orderId) {
        return this.baseMapper.getByOrderId(orderId);
    }

    @Override
    public CustomerCouponPo getByInfo(String customerId, String id) {
        return this.baseMapper.getByInfo(customerId, id);
    }


}
